var username=localStorage.getItem("username");
var token=localStorage.getItem("token");
var userid=localStorage.getItem("userid");
$(function(){
	var paramMap = params();
	var id = paramMap['id'];

	$("#backList").click(function(){
		var url=server_url+'/supplyManage/list.do';
		tl_config.last_url=url;
		tl_config.loadToWorkArea(url);
	});
	
	$.ajax({
		type : 'GET',
		contentType : 'application/json',
		async : false,
		data : {
			supplyid : id,
			token:token
		},
		url : server_url+'/rest/supplyManage/getSupply.do?ran='+Math.random(),
		dataType : 'json',
		success : function(data) {
			if (data.retCode == "0000") {
				pasteData(data.data);
			} else{
				easyDialog.open({
					container:{
						header:'温馨提示',
						content:data.retMsg
					},
					autoClose : 2000
				});
			}
		}
	});
	
});

function isEmpty(data){
	if(data==null||data==undefined||data.length==0){
		return true;
	}else{
		return false;
	}
}
function pasteData(data){
	console.log(data);
	//console.log(data.bankName);
	$("#supplyName").text(data.supplyName);
	$("#resMobile").text(data.resMobile);
	$("#scaleName").text(data.scaleName);
	$("#addTime").text(data.addTime);
	$("#avgYieldName").text(data.avgYieldName);
	$("#address").text(data.provinceName+","+data.cityName+","+data.countyName+","+data.address);
	$("#bank").text(data.bank);
	$("#bankName").text(data.bankName);
	$("#isPedigreeName").text(data.isPedigreeName);
	$("#pedigreeYearName").text(data.pedigreeYearName);
	$("#bankCard").text(data.bankCard);
	$("#isRegisterName").text(data.isRegisterName);
	$("#isVoiceName").text(data.isVoiceName);
	$("#pedigreeImg").attr("src",data.pedigreeImg);
	$("#remark").text(data.remark);
}
